package com.salton123.lib_database

import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.salton123.app.BaseApplication
import com.salton123.lib_database.db.dao.ApkDao
import com.salton123.lib_database.db.entity.ApkEntity

/**
 * Time:5/9/21 7:02 PM
 * Author:
 * Description:
 */
@Database(entities = [ApkEntity::class], version = 1)
abstract class RehaDatabase : RoomDatabase() {
    abstract fun apkDao(): ApkDao

    companion object {
        private const val DB_NAME = "reha.db"
        val Impl: RehaDatabase by lazy {
            Room.databaseBuilder(BaseApplication.sInstance, RehaDatabase::class.java, DB_NAME)
                .setJournalMode(JournalMode.WRITE_AHEAD_LOGGING)
                .fallbackToDestructiveMigration()
                .build()
        }
    }
}